package com.fbinggun.fattribute.attribute.attack;

import com.fbinggun.fattribute.FAttributePlugin;
import com.fbinggun.fattribute.attribute.AAttack;
import com.fbinggun.fattribute.data.DataManage;
import com.fbinggun.fattribute.data.EntityData;
import com.fbinggun.fattribute.effect.FrightenEffect;
import com.fbinggun.fattribute.effect.IEffect;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

public class Frighten extends AAttack {


    @Override
    public double getDamage(EntityData data, EntityDamageByEntityEvent event) {
        FrightenEffect iEffect = new FrightenEffect(20*10,getValue(data),data);
        if(event.getEntity() instanceof LivingEntity){
            EntityData entityData = DataManage.getData((LivingEntity) event.getEntity());
            entityData.addEffect(iEffect);
        }
        return 0;
    }

    @Override
    public String getID() {
        return "Frighten";
    }

    @Override
    public String getKey() {
        return FAttributePlugin.plugin.getConfigKey(getID());
    }
    @Override
    public int getCombat() {
        return 0;
    }
}
